import React, { Component } from 'react'
import Tabbar from '@/components/Tabbar'
import "./App.less"
import { withRouter } from 'react-router-dom'
import Loading from '@/components/Loading'
import MyAlert from './components/MyAlert'

class App extends Component {
    render() {
        return (
            <div>
                <MyAlert />
                {this.props.children}
                <Loading />
                <Tabbar />
            </div>
        )
    }
    UNSAFE_componentWillMount() {
        // 如果当前的地址匹配到/，那么就跳转到/home
        if (this.props.location.pathname === "/") {
            this.props.history.push("/home")
        }
    }
}

export default withRouter(App)